#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
int lengthOfLastWord(char* s)
{
	int ch = strlen(s);
	int end = ch - 1;
	int start = 0;
	while (s[end] == ' ')
		end--;
	start = end;
	while (end >= 0 && s[end] != ' ')
	{
		end--;
	}
	return start - end;
}
int main()
{
	char* s = " a ";
	printf("%d", lengthOfLastWord(s));
	return 0;
}